package com.jcl.recruit.log.dao;

import com.jcl.core.db.DatabaseContext;
import com.jcl.core.utils.StringUtils;
import com.jcl.recruit.log.mapper.ConsoleResumeLogMapper;
import com.jcl.recruit.log.model.ConsoleResumeLog;
import com.jcl.recruit.log.vo.LogPageCondition;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

@Component
public class ConsoleResumeLogDao implements ConsoleResumeLogMapper {

    @Autowired
    private ConsoleResumeLogMapper consoleResumeLogMapper;

    @Override
    public List<ConsoleResumeLog> findList(String dbServerName,
                                           LogPageCondition condition,
                                           Integer limitStart,
                                           Integer limitEnd) {
        if (StringUtils.hasLength(dbServerName)) {
            DatabaseContext.setServerName(dbServerName);
        }

        return consoleResumeLogMapper.findList(dbServerName, condition, limitStart, limitEnd);
    }


    @Override
    public List<Map<String, Object>> consoleFindCount(String dbServerName,
                                                      LogPageCondition condition) {
        if (StringUtils.hasLength(dbServerName)) {
            DatabaseContext.setServerName(dbServerName);
        }
        return consoleResumeLogMapper.consoleFindCount(dbServerName, condition);
    }
}
